
function login() {
    var username = $('#username').val();
    var password = $('#password').val();
    $.ajax({
        url: '/doLogin.do',
        type: 'POST',
        data: {
            'username':username,
            'password':password
        },
        dataType: 'json',
        success: function (resp) {
            checkLoginResp(resp)
        }
    });
}

function checkLoginResp(resp) {
    console.log(resp);
    if(resp.result=='SUCCESS'){
        location.href="/user/menu";
    }else{
        alert(resp.msg);
        console.log(resp.error_code);
    }
}

